function formatDate(date) {
  var year = date.getFullYear()
  var month = date.getMonth() + 1
  var day = date.getDate()

  var hour = date.getHours()
  var minute = date.getMinutes()
  var second = date.getSeconds();

  return `${year}年${fillZerosToFixedLength(month)}月${fillZerosToFixedLength(day)}日 ${fillZerosToFixedLength(hour)}:${fillZerosToFixedLength(minute)}`;
}

function fillZerosToFixedLength(number, fixedLength = 2) {
  let numberStr = number.toString();
  while (numberStr.length < fixedLength) {
    numberStr = '0' + numberStr;
  }
  return numberStr;
}

module.exports = {
  formatDate: formatDate
}
